package com.map.hashmap;

import java.util.HashMap;
import java.util.Map;

public class FindDuplicateCharacters {
public static void main(String[] args) {
	findDuplicatCharacters("amit");
}
public static void findDuplicatCharacters(String word){
	char[] character=word.toCharArray();
	Map<Character, Integer> map=new HashMap<Character, Integer>();
	for(Character ch:character){
		if(map.containsKey(ch)){
			map.put(ch, map.get(ch)+1);
		}else{
			map.put(ch, 1);
		}
	}
	for(Map.Entry<Character, Integer> entry:map.entrySet()){
		if(entry.getValue()>1){
			System.out.println(entry.getKey()+"\t"+entry.getValue());
		}
	}
	throw new RuntimeException("didn't find any repeated characters...");
}
}
